package com.android.porttallymansystem.logic.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.android.porttallymansystem.logic.model.Work

@Dao
interface WorkDao {

    @Insert
    fun insertWork(work: Work): Long

    @Query("select * from Work")
    fun loadWork(): List<Work>

    @Query("select * from Work where workerId = :workerId")
    fun loadWorkByWorkerId(workerId: Long): MutableList<Work>

    @Query("select * from Work where id = :id")
    fun loadWorkById(id: Long): Work

    @Update
    fun updateWork(newWork: Work)
}